Skip to content

[WIP] Add fermionic support to belief-propagation simple update#155

Draft
mtfishman wants to merge 7 commits into
mainfrom
mf/fermion-bp-sign
Draft

[WIP] Add fermionic support to belief-propagation simple update#155
mtfishman wants to merge 7 commits into
mainfrom
mf/fermion-bp-sign

Conversation

@mtfishman

@mtfishman mtfishman commented Jul 22, 2026

Copy link
Copy Markdown
Member

Summary

Adds fermionic support to the belief-propagation simple-update apply-gate (apply_operators). The odd-parity sign on a fermionic bond needs care in the gauge. Each directed message is built as the doubled contraction of the gate factor with its conjugate, which carries the sign, and the gauge roots each message in the bipartition where it is positive semidefinite. The bosonic path is unchanged.

TODO

  • Add fermionic (FermionParity) apply-gate test coverage
  • Add a fermionic BP example
  • CI green

mtfishman and others added 3 commits July 21, 2026 17:32
Keep belief-propagation messages as operators and normalize them by their trace rather than an entrywise sum, which stays sign correct on fermionic bonds where the entrywise sum can flip the odd-parity block. Gauge the simple-update tensors with the balanced square root and inverse square root of the Hermitian-projected bond messages.

Depends on the operator-form Hermitian factorizations added in the ITensorBase mf/operator-sqrth branch.
The BP simple-update gauge absorbs an operator-valued square root of each incoming message into the state tensor. Contracting it with `*` returns an operator, so the updated state is written back as an operator and rejected by the state network. Take the underlying tensor of each gauge (`ITB.state`) before contracting, so the gauged state stays a plain tensor while the index arrows still carry the fermion sign. Requires the operator `dimnametype` fix from ITensor/ITensorBase.jl#225.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Store both directed messages of a bond uniformly as the bond (ket output) and
an auxiliary leg (bra input), with conj(S)/S into the two endpoints, and build
the initial identity messages on the source-side ket axis so their ket leg is
dual to the destination bond. The gauge projects the message Hermitian and takes
the balanced square-root / inverse-square-root in whichever bipartition is
positive semidefinite, which recovers the odd-parity fermion sign in both
directions. Migrate the message-update path to the ITensorBase 0.13
outputnames/inputnames API and bump to 0.9.10.
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (fd57853) to head (8d169d4).

Files with missing lines Patch % Lines
src/apply/apply_operators.jl 0.00% 10 Missing ⚠️
src/beliefpropagation/beliefpropagation.jl 0.00% 6 Missing ⚠️
src/beliefpropagation/messagecache.jl 0.00% 3 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (fd57853) and HEAD (8d169d4). Click for more details.

HEAD has 16 uploads less than BASE
Flag BASE (fd57853) HEAD (8d169d4)
docs 3 1
14 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #155       +/-   ##
==========================================
- Coverage   84.89%   0.00%   -84.90%     
==========================================
  Files          15      13        -2     
  Lines         662     636       -26     
==========================================
- Hits          562       0      -562     
- Misses        100     636      +536     
Flag Coverage Δ
docs 0.00% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

mtfishman and others added 3 commits July 22, 2026 11:01
Replace the try/catch PSD-bipartition selection in `message_gauge` with a
plain transposed gauge. The two directed bond messages are now built from the
PSD singular-value message `conj(S)`. The reverse direction is its arrow flip
via `dualize`, which toggles `isdual` and keeps the odd-parity block, rather
than `conj`, which negates the odd block and breaks PSD. Free-fermion
validation is exact to machine precision on trees with no fallback.

`dualize` is a temporary element-wise hack that pulls in a temporary
`GradedArrays` dependency. Both stand in for a proper backend-agnostic
duality-flip primitive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The reverse directed message is S with its bond orientation reversed,
which is the ribbon twist of S (-1 on the odd-parity sector). Both
directed messages are then positive semidefinite in the transposed
gauge, so the gauge needs no fallback. This replaces the element-wise
dualize helper with a name-keyed twist and twist!.

Also simplify the belief-propagation message unwrap to state.(messages),
relying on state being idempotent.
@mtfishman
mtfishman force-pushed the mf/fermion-bp-sign branch from 03f6abd to 0f0ec76 Compare July 24, 2026 17:36
…n twist

Each directed simple-update message is now the doubled contraction of the gate
factor with its conjugate, rather than being read off the singular-value spectrum
as conj(S) and a ribbon-twisted S. The graded contraction of a factor with its
conjugate carries the odd-parity fermion sign on its own, so the explicit ribbon
twist (and the direct GradedArrays dependency it needed) is gone.
@mtfishman
mtfishman force-pushed the mf/fermion-bp-sign branch from 0f0ec76 to 8d169d4 Compare July 24, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant